<template>
  <div class="">
    <h5>用户列表</h5>
    <el-table :data="list" border style="width: 100%">
      <el-table-column prop="id" label="id" width="180"> </el-table-column>
      <el-table-column prop="name" label="姓名" width="180"> </el-table-column>
      <el-table-column prop="age" label="年龄"> </el-table-column>
      <el-table-column label="操作">
        <template slot-scope="scope">
          <el-button @click="gotodetail(scope.row)">详情</el-button>
        </template>
      </el-table-column>
    </el-table>
  </div>
</template>

<script>
export default {
  data() {
    return {
      list: [
        {
          name: "小明",
          age: 19,
          id: 11,
        },
        {
          name: "小hong",
          age: 20,
          id: 12,
        },
        {
          name: "小丽",
          age: 22,
          id: 13,
        },
        {
          name: "小凯",
          age: 25,
          id: 14,
        },
        {
          name: "小黑",
          age: 17,
          id: 15,
        },
      ],
    };
  },
  created() {},
  methods: {
    gotodetail(item) {
      console.log(item);
      this.$router.push({ path: "/detail", query: { obj: item } });
    },
  },
  components: {},
};
</script>

<style lang="scss"></style>
